<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>tabp Admin-Login</title>
    </head>
    <body>
        <?php
        require_once '../modules/MessageManager/MessageManager.php';
        // TODO: Evtl. Weg ohne GET-Variable finden..
        if (isset($_GET['logout'])) {
            MessageManager::writeMessage('Ausgeloggt!', 0);
        }
        session_start();

        if (isset($_SESSION['tabp_admin']) && isset($_SESSION['tabp_failed'])) {
            if ((!$_SESSION['tabp_admin']) && ($_SESSION['tabp_failed'])) {
                MessageManager::writeMessage('Login fehlerhaft. Bitte erneut versuchen', 2);
            }
            if (($_SESSION['tabp_admin']) && (!$_SESSION['tabp_failed'])) {
                header('Location: index.php?page=welcome');
                exit();
            }
        }
        ?>
        <form action="login_check.php" method="POST">
            <input type="text" name="username" /> <br />
            <input type="password" name="userpass" /> <br />
            <input type="submit" name="sub" value="senden"/>
        </form>
    </body>
</html>